<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use common\models\grade\Grade;
use yii\helpers\ArrayHelper;
use common\models\gradeship\Gradeship;
$gradeship = Gradeship::find()->asArray()->all();

$arr =[ ['id'=>'','name'=>'无']];
$newgradeship = array_merge($arr,$gradeship);

/* @var $this yii\web\View */
/* @var $model common\models\grade\Grade */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="grade-form">

    <?php $form = ActiveForm::begin(); ?>

    <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
    <?= $form->field($model, 'gradeshipid')->label('优惠')->dropDownList(ArrayHelper::map($newgradeship, 'id', 'name')) ?>
    <?= $form->field($model, 'status')->dropDownList(Grade::getArrayStatus()) ?>



    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
